package com.hiwan.wechat.pojo;

import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONObject;

public class NewsMessage extends BaseMessage {
	public News news;
	
	public NewsMessage() {
		this.msgtype = "news";
		this.news = new News();
	}
	@Override
	public String parseToJsonStr() {
//		"{"+ 
//				"\"touser\": \"@all\"," +
//				"\"toparty\": \"1\"," +
//				"\"totag\": \"问卷调查\"," +
//				"\"msgtype\": \"news\"," +
//				"\"agentid\": 1," +
//				"\"news\": {" +
//			        "\"articles\":[ "+
//                      "   {"+
//			             "  \"title\": \"Title\","+
//			             "  \"description\": \"Description\","+
//			             "  \"url\": \"http://www.baidu.com\",\""+
//			             "  \"picurl\": \"\""+
//			           "}  "+
//			       "]"+
//			   "}"+
//			"}"
		
		JSONObject json= JSONObject.fromObject(this);
		return json.toString();
	}
	
	public News getNews() {
		return news;
	}
	public void setNews(News news) {
		this.news = news;
	}

	public class Article{
		public String title;
		public String description;
		public String url;
		public String picurl;
		
		public Article() {
		}
		
		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
		public String getDescription() {
			return description;
		}
		public void setDescription(String description) {
			this.description = description;
		}
		public String getUrl() {
			return url;
		}
		public void setUrl(String url) {
			this.url = url;
		}
		public String getPicurl() {
			return picurl;
		}
		public void setPicurl(String picurl) {
			this.picurl = picurl;
		}
	}
	public class News{
		public List<Article> articles;
		
		public News() {
			this.articles = new ArrayList<Article>();
		}

		public List<Article> getArticles() {
			return articles;
		}
		
		public void setArticles(List<Article> articles) {
			this.articles = articles;
		}
	}
}
